/* eslint-disable react/require-default-props */
import { Row, Col } from 'antd';
import React,{ useEffect } from 'react';
import page from '../../page.less';
import {getDict} from '@/service/common/dict'

interface InfoType {
  label: string;
  value: string;
  state:any;
  title:string;
}
interface Props {
  info: any[];
  span: number;
  state?: any;
  title?: string;
}
function Info({ info, span, state, title }: Props) {
  // const [payState,setPayState] = useState()
  useEffect(()=>{
    getDict(
			{
				dictKeys: [
					'order_finance_pay_status', // 支付状态
				],
			},
			(res: any) => {
        res?.order_finance_pay_status.forEach((item:any)=>{
          if(state?.payStatus === item?.dictKey?.toString()){
            // setPayState(item?.dictValue)
          }
            
        })
        
			}, // 字典
		)
  },[])
  return (
    <div className={`${page.page}  ${page.card}`} id="basic">
      <div className={page.dotTitle}>
        {title}
        {state && (
          <div className={page.state}>
            {state.label}：{state.value}
          </div>
        )}
      </div>
      <Row gutter={24} className={page.rows}>
        {info.map((item: InfoType) => (
          <Col span={span} className={page.col} key={item?.label}>
            <div className={page.label} >{item.label}：</div>
            <div className={page.value} >{item.value}</div>
          </Col>
        ))}
      </Row>
    </div>
  );
}

export default Info;
